package com.avcdata.aoscustommade.model;

import android.content.Context;

import com.avcdata.aoscustommade.R;
import com.avcdata.aoscustommade.main.BaseCallBack;
import com.avcdata.aoscustommade.utils.AvcConstants;
import com.avcdata.aoscustommade.utils.http.AvcHttpUtils;
import com.avcdata.aoscustommade.utils.http.AvcJsonHttpResponseHandler;

import org.json.JSONException;
import org.json.JSONObject;



/**
 * 欢迎界面的model
 * Created by zyh on 17/6/12.
 */

public class WelcomeViewModel {
    private final Context mContext;

    public WelcomeViewModel(Context context) {
        this.mContext = context;
    }

    /**
     * 获取当前周
     * @param lastWeekCount
     * @param baseCallBack
     */
    public void loadSelectCategory(String lastWeekCount, final BaseCallBack baseCallBack) {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("lastWeekCount", lastWeekCount);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        String url = "";
            url = AvcConstants.URLHeaderBase+AvcConstants.URLHeaderSelectInfo1;

        AvcHttpUtils.post(url + "getDateSelectCategory", jsonObject, new AvcJsonHttpResponseHandler(mContext){
            @Override
            public void onSuccess(JSONObject object) {
                super.onSuccess(object);
               baseCallBack.onSuccess(object);
            }
        });
    }

}
